package cn.bj.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.bj.beans.Yxjd;
import cn.bj.beans.YxjdExample;
import cn.bj.dao.YxjdMapper;

@Service
public class YxjdService {

	@Autowired
	YxjdMapper yxjdMapper;

	// 查询所有
	public List<Yxjd> selectAllYxjd() {
		YxjdExample yxjdExample = new YxjdExample();
		yxjdExample.setOrderByClause("`sort` DESC,id ASC");
		return yxjdMapper.selectByExample(yxjdExample);
	}

	// 插入
	public int insrtYxjd(Yxjd yxjd) {
		return yxjdMapper.insert(yxjd);
	}

	// 删除
	public int deleteYxjd(Integer id) {
		return yxjdMapper.deleteByPrimaryKey(id);
	}

	// 查询单个
	public Yxjd selectById(Integer id) {
		return yxjdMapper.selectByPrimaryKey(id);
	}

	// 修改
	public int updateYxjd(Yxjd yxjd) {
		return yxjdMapper.updateByPrimaryKey(yxjd);
	}

}
